#include<iostream>
using namespace std;
const int N = 1e4 + 10;
int f[N];
int arr[4] = { 0,150,200,350 };
int n;
int main()
{
	int t;
	cin >> t;
	while (t--) {
		memset(f, 0, sizeof(f));
		cin >> n;
		for (int i = 1; i <= 3; i++) {
			for (int j = arr[i]; j <= n; j++) {
				f[j] = max(f[j], f[j - arr[i]] + arr[i]);
			}
		}
		cout << n - f[n] << endl;
	}
	return 0;
}